import pygame
class Huojian:
    def __init__(self,ai_game):
        self.pingmu=ai_game.pingmu
        self.pingmu_rect=ai_game.pingmu.get_rect()
        self.image = pygame.image.load('images/rocket.png')
        self.image = pygame.transform.rotate(self.image,360)#更改火箭图片的方向
        self.rect = self.image.get_rect()
        self.rect.midbottom = self.pingmu_rect.midbottom

        self.biaozhi_right = False
        self.biaozhi_left = False
        self.biaozhi_up = False
        self.biaozhi_dow = False
    def update(self):
        if self.biaozhi_right and self.rect.right < self.pingmu_rect.right:
            self.rect.x+=1
        if self.biaozhi_left and self.rect.left > 0:
            self.rect.x-=1
        if self.biaozhi_up and self.rect.top > 0:
            self.rect.y-=1
        if self.biaozhi_dow and self.rect.bottom < self.pingmu_rect.bottom:
            self.rect.y+=1

    def huizhi(self):
        self.pingmu.blit(self.image,self.rect)